package com.qiantu.phone.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.HashMap;

public class RecommendSceneDeviceBean implements Parcelable {

    private String key;
    private String name;
    private String image;
    private String baseType;
    private int selectedDeviceCount;
    private OpeartionDTO opeartion;

    protected RecommendSceneDeviceBean(Parcel in) {
        key = in.readString();
        name = in.readString();
        image = in.readString();
        baseType = in.readString();
        selectedDeviceCount = in.readInt();
        opeartion = in.readParcelable(OpeartionDTO.class.getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(key);
        dest.writeString(name);
        dest.writeString(image);
        dest.writeString(baseType);
        dest.writeInt(selectedDeviceCount);
        dest.writeParcelable(opeartion, flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<RecommendSceneDeviceBean> CREATOR = new Creator<RecommendSceneDeviceBean>() {
        @Override
        public RecommendSceneDeviceBean createFromParcel(Parcel in) {
            return new RecommendSceneDeviceBean(in);
        }

        @Override
        public RecommendSceneDeviceBean[] newArray(int size) {
            return new RecommendSceneDeviceBean[size];
        }
    };

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getBaseType() {
        return baseType;
    }

    public void setBaseType(String baseType) {
        this.baseType = baseType;
    }

    public int getSelectedDeviceCount() {
        return selectedDeviceCount;
    }

    public void setSelectedDeviceCount(int selectedDeviceCount) {
        this.selectedDeviceCount = selectedDeviceCount;
    }

    public OpeartionDTO getOpeartion() {
        return opeartion;
    }

    public void setOpeartion(OpeartionDTO opeartion) {
        this.opeartion = opeartion;
    }

    public static class OpeartionDTO implements Parcelable{
        private HashMap<String, String> status;

        protected OpeartionDTO(Parcel in) {
            status = new HashMap<>();
            in.readMap(status, getClass().getClassLoader());
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeMap(status);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public static final Creator<OpeartionDTO> CREATOR = new Creator<OpeartionDTO>() {
            @Override
            public OpeartionDTO createFromParcel(Parcel in) {
                return new OpeartionDTO(in);
            }

            @Override
            public OpeartionDTO[] newArray(int size) {
                return new OpeartionDTO[size];
            }
        };

        public HashMap<String, String> getStatus() {
            return status;
        }

        public void setStatus(HashMap<String, String> status) {
            this.status = status;
        }
    }
}
